/*package cn.wolfcode.luowowo;

import cn.wolfcode.luowowo.article.job.SingleTask;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

@org.springframework.context.annotation.Configuration
public class Configuration {
    //定时器相关配置
    @Bean
    public MethodInvokingJobDetailFactoryBean detailFactoryBean(SingleTask task) {
        MethodInvokingJobDetailFactoryBean jobDetailFactoryBean = new MethodInvokingJobDetailFactoryBean();
        jobDetailFactoryBean.setConcurrent(false);
        jobDetailFactoryBean.setName("printOut");
        jobDetailFactoryBean.setGroup("printOut_group");
        jobDetailFactoryBean.setTargetObject(task);
        jobDetailFactoryBean.setTargetMethod("singleTask");
        return jobDetailFactoryBean;
    }

    @Bean
    public CronTriggerFactoryBean cronTrigger(MethodInvokingJobDetailFactoryBean detailFactoryBean) {
        CronTriggerFactoryBean triggerFactoryBean = new CronTriggerFactoryBean();
        triggerFactoryBean.setJobDetail(detailFactoryBean.getObject());
        // 设置表达式,每3秒执行一次
        triggerFactoryBean.setCronExpression("0/3 * * * * ?");
        triggerFactoryBean.setName("everyThreeSeconds");
        return triggerFactoryBean;
    }

    @Bean
    public SchedulerFactoryBean schedulerFactory(CronTriggerFactoryBean cronTrigger) {
        SchedulerFactoryBean bean = new SchedulerFactoryBean();
        // 设置是否任意一个已定义的Job会覆盖现在的Job。默认为false，即已定义的Job不会覆盖现有的Job。
        bean.setOverwriteExistingJobs(true);
        // 延时启动，应用启动10秒后，定时器才开始启动
        bean.setStartupDelay(10);
        // 注册定时触发器
        bean.setTriggers(cronTrigger.getObject());
        return bean;
    }
}*/
